<template>
    <div class="layerRtb layerRtb-threecolumn">
        <three-title :title="{name:'当阶'}"></three-title>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="50">
     <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >押金</p>
                    <div class="analyItemCon">
                           <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}万</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
                            <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
    <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>
                <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center">单限</p>
                   <div class="analyItemCon">
                            <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}万</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
                               <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
    <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                <p  class="analyItemTit tx-center">竣工</p>
                    <div class="analyItemCon">
                            <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}万</span>
                        </p>
                           <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
                      <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
           <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                           <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center">总限</p>
                    <div class="analyItemCon">
                          <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}万</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
                                <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
           <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >培训次数</p>
                 <div class="analyItemCon">
                       <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                          <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                    <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>

                        </p>
           <p class="col-md-2">
                         <span class="cRed">10%</span>
                         <span class="circlemark circlemark-lightRed" >差</span>
                        </p>

                    </div>
                </router-link>


                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >工人</p>
                  <div class="analyItemCon">
                           <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                    <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
               <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >积分</p>
                <div class="analyItemCon">
                          <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                           <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                  <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
    <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >证书</p>
                 <div class="analyItemCon">
                           <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                           <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                  <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>

                        </p>
           <p class="col-md-2">
                           <span class="cRed">10%</span>
                                   <span class="circlemark circlemark-lightRed" >差</span>
                        </p>

                    </div>
                </router-link>


                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >成就</p>
                   <div class="analyItemCon">
                            <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}万</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>
                        </p>
                <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}万</span>

                        </p>
           <p class="col-md-2">
                            <span class="cRed">10%</span>
                             <span class="circlemark circlemark-lightRed" >差</span>
                        </p>

                    </div>
                </router-link>

                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center">产值比</p>
                <div class="analyItemCon">
                            <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                          <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                               <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>

                        </p>
           <p class="col-md-2">
                            <span class="cGreen">100%</span>
                              <span class="circlemark circlemark-lightRed" >差</span>
                        </p>

                    </div>
                </router-link>


                       <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >项目好评</p>
               <div class="analyItemCon">
                           <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                  <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>

                        </p>
                        <p class="col-md-2">
                        <span class="cRed">10%</span>
                            <span class="circlemark circlemark-lightRed" >差</span>
                        </p>
                    </div>
                </router-link>

                          <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >人评</p>
                <div class="analyItemCon">
                        <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                          <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                      <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>

                        </p>
           <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                          <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >材评</p>
                  <div class="analyItemCon">
                        <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                           <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                        <p class="col-md-2">
                            <span class="cRed">10%</span>
                          <span class="circlemark circlemark-lightRed" >差</span>
                        </p>
                    </div>
                </router-link>


                          <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >质评</p>
                    <div class="analyItemCon">
                            <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                            <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                        <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>

                        </p>
                   <p class="col-md-2">
                            <span class="cRed">10%</span>
                                  <span class="circlemark circlemark-lightRed" >差</span>
                        </p>

                    </div>
                </router-link>


                          <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p class="analyItemTit tx-center" >现评</p>
                    <div class="analyItemCon">
                  <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>    <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                           <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
           <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>

                <!-- <router-link tag="div" :to="routerPath('')"  class="analyItem" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">保障</p>
            <div class="analyItemCon">
                <p class="col-md-6">
                    <span class="cLightGray pr8">五险</span>
                    <span></span>
                </p>
                <p class="col-md-6">
                    <span class="cLightGray pr8">加点</span>
                    <span></span>
                </p>
            </div>
        </router-link>-->
                <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p  class="analyItemTit tx-center">安全员证</p>
                <div class="analyItemCon">
                        <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                        <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                      <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
           <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>
                <router-link tag="div" :to="routerPath('')" class="analyItem" active-class="anItemBor-active">
                    <p  class="analyItemTit tx-center">培训</p>
                    <div class="analyItemCon">
                        <p class="col-md-3">
                            <span class="cLightGray pr8">标准</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptMoney/10000).toFixed(2):0}}</span>
                        </p>
                        <p class="col-md-3">
                            <span class="cLightGray pr8">完成</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                    <p class="col-md-4">
                            <span class="cLightGray pr8">差额</span>
                            <span>{{upgradeInfo?(upgradeInfo.leReceiptNum/10000).toFixed(2):0}}</span>
                        </p>
                        <p class="col-md-2">
                            <span class="cGreen">100%</span>
                               <span class="circlemark circlemark-lightGreen">优</span>
                        </p>

                    </div>
                </router-link>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { findUpgradeInfo,
    getPMUpgradeMsg,
    getAchievementMsg} from '../../Resources/Api/index'
export default {
    data () {
        return {
            pmUpgrage: {},
            pmAchievement: {},
            upgradeInfo: {},
            money: 0,
            completeNumbedr: 1
        }
    },
    created () {
        this.GetLeveInfo()
    },
    methods: {
    // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        },
        GetLeveInfo () {
            let _this = this
            _this.upgradeInfo = {}
            findUpgradeInfo({
                uid: this.leftInfo.uid
            }).then(results => {
                this.upgradeInfo = results.data.Body
                if (this.upgradeInfo) {
                    if (this.upgradeInfo.depositCash >= this.upgradeInfo.leDeposit) {
                        this.completeNumbedr += 1
                    }
                    if (this.upgradeInfo.leSecurityOpen === 1) {
                        this.completeNumbedr += 1
                    }
                    if (this.upgradeInfo.leTrainingNum > 0) {
                        this.completeNumbedr += 1
                    }
                }
                this.GetAchievement()
            }).catch(error => {
                console.log(error)
            })
        },
        GetPMUpgrade () {
            let _this = this
            _this.pmUpgrage = []
            getPMUpgradeMsg({
                uid: this.leftInfo.uid
            }).then(results => {
                this.pmUpgrage = results.data.Body
                if (this.pmUpgrage != null && this.upgradeInfo != null) {
                    const currentMoney = this.pmUpgrage[0].surplus_money ? (this.money + this.pmUpgrage[0].surplus_money) : this.money
                    if (this.upgradeInfo.leComplete <= currentMoney && this.upgradeInfo.leComplete > 0) {
                        this.completeNumbedr += 1
                    }
                }
            }).catch(error => {
                console.log(error)
            })
        },
        GetAchievement () {
            let _this = this
            _this.pmAchievement = []
            getAchievementMsg({
                uid: this.leftInfo.uid,
                state: 1
            }).then(results => {
                this.pmAchievement = results.data.Body

                if (this.pmAchievement) {
                    this.pmAchievement.forEach(element => {
                        this.money += element.grossProfitReceived
                    })
                }
                this.GetPMUpgrade()
            }).catch(error => {
                console.log(error)
            })
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    },
    updated: function () {
    },
    watch: {
        leftInfo () {
            this.completeNumbedr = 1
            this.money = 0
            this.GetLeveInfo()
        }
    }
}
</script>
